$dropdown-width: 350px;

.navbar {
    background-color: $primary;
    display: flex;
    height: $navbar;
    justify-content: space-between;
    position: relative;
    &::after {
        background-size: 200%;
        bottom: 0;
        content: '';
        height: 100%;
        left: 0;
        position: absolute;
        right: 0;
        top: 0;
        z-index: -1;
    }
    .nav-left,
    .nav-right {
        align-content: center;
        align-items: center;
        display: flex;
    }
    .nav-left {
        a {
            color: $white;
            padding: .5rem 1.5rem;
        }
        .logo {
            background: rgba($black, .2);
            padding: .3rem .75rem;
        }
        svg {
            @include svg-size(1.6rem);
        }
    }
    .nav-right {
        margin-left: auto;
        > a,
        .topnav-dropdown-wrapper > a {
            color: $white;
            margin: 0;
            padding: .5rem 2rem;
        }
        .active {
            background: rgba($white, .95);
            color: $secondary-dark;
            svg {
                fill: $primary-50;
                stroke: $primary-50;
            }
        }
        svg {
            @include svg-size(1.2rem);
            fill: $primary-50;
            stroke: $primary-50;
            transition: all .2s linear;
        }
    }
    .nav-right > a,
    .topnav-dropdown-wrapper > a {
        color: $white;
        display: inline-block;
        transition: all .2s linear;
        &:hover {
            background: rgba($black, .2);
            color: $primary-light;
            svg {
                fill: $primary-25;
                stroke: $primary-25;
            }
        }
        &.user-avatar {
            line-height: 40px;
            min-height: 40px;
            min-width: 200px;
            padding: 0;
            padding-left: 2rem;
            text-align: right;
            span {
                padding-right: 1rem;
            }
        }

    }
    .user-avatar img {
        @include avatar-img(2.5rem);
        margin-left: .5rem;
        vertical-align: middle;
    }
    .topnav-dropdown-wrapper {
        position: relative;
        &:hover {
            .navbar-dropdown {
                animation: dropdownFade .2s cubic-bezier(.09, 0, .99, .01) both;
                display: block;
            }
        }
    }
    %dropdown {
        border-radius: 2px;
        display: none;
        left: calc(50% - #{$dropdown-width}/2);
        min-width: $dropdown-width;
        position: absolute;
        top: 2.4rem;
        z-index: 999;
    }
}

.navbar-dropdown {
    @extend %dropdown;
    background: $blackish;
    border: 1px solid $black;
    padding: .3rem;
    &.dropdown-user {
        left: calc(50% - 200px/2);
        min-width: 200px;
        ul {
            margin-bottom: 0;
        }
    }
    ul {
        @include arrow('bottom', $blackish, $blackish, 1, 8);
        margin: 0;
        margin-bottom: .5rem;
        padding: 0;
    }
    .plugin {
        &:hover {
            .new {
                color: $white;
            }
        }
        .new {
            @include font-size(small);
            background: $red-light;
            float: right;
            margin-left: auto;
            padding: .1rem .25rem;
        }
    }
    a {
        color: $whitish;
        display: block;
        padding: .8rem .5rem;
        &:hover {
            background: rgba($white, .1);
            color: $primary-light;
        }
        &.see-more-projects-btn,
        &.create-organization-btn,
        &.create-project-btn {
            color: $white;
            text-align: center;
            &:hover {
                color: $white;
            }
        }
        &.see-more-projects-btn {
            display: flex;
            margin-bottom: .3rem;
            padding: 0;
        }
        &.create-project-btn {
            display: flex;
            flex: 1;
            padding: 0;
        }
        &.blocked-project {
            color: $gray;
            svg {
                margin-left: .5rem;
                position: relative;
                top: .25rem;
            }
        }
    }
    .create-options {
        display: flex;
        flex-direction: row;
    }
}


@keyframes highlightFadeOut {
    0% {
        background: $primary-light;
        font-size: .75rem;
        height: 22px;
        left: 49px;
        line-height: 22px;
        top: -1px;
        width: 22px;
    }
    20% {
        font-size: .7rem;
        height: 20px;
        left: 50px;
        line-height: 20px;
        top: 0;
        width: 20px;
    }
    100% {
        background: $primary;
    }
}


.topnav-dropdown-wrapper {
    position: relative;
    &:hover {
        .navbar-dropdown-notifications {
            animation: dropdownFade .2s cubic-bezier(.09, 0, .99, .01) both;
            display: block;
        }
    }
    .counter {
        @include font-type(bold);
        background: $secondary;
        border-radius: 50%;
        color: $white;
        font-size: .7rem;
        height: 18px;
        left: 52px;
        line-height: 18px;
        position: absolute;
        text-align: center;
        top: 3px;
        width: 18px;
        &.small {
            height: 17px;
            line-height: 17px;
            width: 17px;
        }
        &.large {
            height: 22px;
            line-height: 22px;
            top: 2px;
            width: 22px;
        }
        &.counter-active {
            animation-duration: 2s;
            animation-name: highlightFadeOut;
        }
    }
    .navbar-dropdown-notifications {
        $width: 450px;
        background: $white;
        border: 1px solid $whitish;
        border-radius: 2px;
        box-shadow: 0 0 3px 3px rgba($gray-lighter, .2);
        color: $blackish;
        display: none;
        left: calc(50% - 450px/2);
        margin-top: 1px;
        min-width: 450px;
        padding: 0;
        position: absolute;
        top: 2.4rem;
        z-index: 999;

        .empty {
            color: $gray-light;
            font-size: .9em;
            padding: 1.5em 0;
            text-align: center;
            width: 100%;
        }
        .header {
            @include arrow('bottom', $mass-white, $mass-white, 1, 8);
            background: $mass-white;
            color: $gray;
            display: flex;
            flex-direction: row;
            padding: .6rem .75rem;
            .notifications-title {
                flex-grow: 1;
                text-transform: uppercase;
            }
        }
        .action {
            font-size: .9rem;
            padding-left: 1.2rem;
            text-align: right;
            &.disabled {
                color: $gray-lighter;
                cursor: default;
            }
            &:not(.disabled) {
                color: $primary;
            }
            &:not(.disabled):hover {
                color: $primary-light;
            }
        }
        .notifications-wrapper {
            min-height: 70px;
        }
        .notifications-list {
            max-height: 400px;
            overflow-y: auto;
        }
    }
}
